package com.yugao.fintech.draper.log.service;

import com.yugao.fintech.draper.auth.api.LogFeignApi;
import com.yugao.fintech.draper.auth.dto.LoginLogDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;

/**
 * 异步操作日志服务
 */
@Slf4j
@RequiredArgsConstructor
public class AsyncLogService {

    private final LogFeignApi logFeignApi;

    /**
     * 保存系统日志记录
     */
    @Async
    public void saveLog(LoginLogDTO operLog) {
        log.debug("调用异步方法保存日志:{}", Thread.currentThread().getId());
        logFeignApi.add(operLog);
    }
}
